package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.YzStudentLiwu;
import com.ruoyi.system.mapper.YzStudentLiwuMapper;
import com.ruoyi.system.service.IYzStudentLiwuService;
import com.ruoyi.system.util.IdGenerate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 学生礼物信息Service业务层处理
 *
 * @author linpq
 * @date 2020-04-10
 */
@Service
public class YzStudentLiwuServiceImpl implements IYzStudentLiwuService
{
    @Autowired
    private YzStudentLiwuMapper yzStudentLiwuMapper;

    /**
     * 查询学生礼物信息
     *
     * @param id 学生礼物信息ID
     * @return 学生礼物信息
     */
    @Override
    public YzStudentLiwu selectYzStudentLiwuById(String id)
    {
        return yzStudentLiwuMapper.selectYzStudentLiwuById(id);
    }

    /**
     * 查询学生礼物信息列表
     *
     * @param yzStudentLiwu 学生礼物信息
     * @return 学生礼物信息
     */
    @Override
    public List<YzStudentLiwu> selectYzStudentLiwuList(YzStudentLiwu yzStudentLiwu)
    {
        return yzStudentLiwuMapper.selectYzStudentLiwuList(yzStudentLiwu);
    }

    /**
     * 新增学生礼物信息
     *
     * @param yzStudentLiwu 学生礼物信息
     * @return 结果
     */
    @Override
    public int insertYzStudentLiwu(YzStudentLiwu yzStudentLiwu)
    {
        yzStudentLiwu.setCreateTime(DateUtils.getNowDate());
        yzStudentLiwu.setId(IdGenerate.uuid());
        return yzStudentLiwuMapper.insertYzStudentLiwu(yzStudentLiwu);
    }

    /**
     * 修改学生礼物信息
     *
     * @param yzStudentLiwu 学生礼物信息
     * @return 结果
     */
    @Override
    public int updateYzStudentLiwu(YzStudentLiwu yzStudentLiwu)
    {
        yzStudentLiwu.setUpdateTime(DateUtils.getNowDate());
        return yzStudentLiwuMapper.updateYzStudentLiwu(yzStudentLiwu);
    }

    /**
     * 删除学生礼物信息对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteYzStudentLiwuByIds(String ids)
    {
        return yzStudentLiwuMapper.deleteYzStudentLiwuByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除学生礼物信息信息
     *
     * @param id 学生礼物信息ID
     * @return 结果
     */
    @Override
    public int deleteYzStudentLiwuById(String id)
    {
        return yzStudentLiwuMapper.deleteYzStudentLiwuById(id);
    }
}
